<%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2022/7/7
  Time: 10:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>新生注册</title>
</head>
<body>
  <form method="post" action="${pageContext.request.contextPath}/student/add"  enctype="multipart/form-data">
      <h1>新生注册</h1>
      <div>
          <label for="sname">姓名：</label>
          <input type="text" name="sname" id="sname" required/>
          <span>*请输入学生姓名</span>
      </div>
      <div>
          <label>性别：</label>
          <input type="radio" name="sex" value="男" checked>男
          <input type="radio" name="sex" value="女">女
          <input type="radio" name="sex" value="妖">妖
          <input type="radio" name="sex" value="人妖">人妖
      </div>
      <div>
          <label for="birth">生日：</label>
          <input type="date" name="birthday" id="birth">
          <span>*请选择日期</span>
      </div>
      <div>
          <label for="tele">电话：</label>
          <input type="text" name="telephone" id="tele" pattern="^1[0-9]{10}$">
          <span>*请输入电话</span>
      </div>
      <div>
          <label for="qq">QQ：</label>
          <input type="text" name="qq" id="qq" pattern="^[0-9]*$">
          <span>*请输入QQ</span>
      </div>
      <div>
          <label for="wechat">微信：</label>
          <input type="text" name="wechat" id="wechat" pattern="^\w*$">
          <span>*请输入微信</span>
      </div>

      <div>
          <label for="gradeid">年级：</label><%--
          <input type="number" name="gradeid" id="gradeid"/>--%>
         <select name="gradeid" id="gradeid">
              <c:forEach items="${grades}" var="grade">

                  <option value="${grade.id}">${grade.gname}
                  </option>
              </c:forEach>
          </select>
          <span>*请选择年级</span>
      </div>
      <div>
          <label for="enterDate">入学日期：</label>
          <input type="date" name="enterdate" id="enterDate">
          <span>*请选择日期</span>
      </div>
      <div>
          <label for="city">城市：</label>
          <input type="text" name="city" id="city">
          <span>*请输入城市</span>
      </div>
      <div>
          <label for="address">地址：</label>
          <input type="text" name="address" id="address">
          <span>*请输入住址</span>
      </div>
      <div>
          <label for="pass">密码：</label>
          <input type="text" name="pass" id="pass">
          <span>*请输入密码</span>
      </div>
    <div>
          <label for="idpic">证件照：</label>
          <input type="file" name="shenfenzheng" id="idpic" onchange="setImagePreviews(this)">
          <span>*请上传文件</span>
          <div id="imgbox"></div>
      </div>
      <p>
          <input type="submit" value="注册"/>
      </p>
  </form>
<script>
    function setImagePreviews(t){
        var file = t.files[0];//获取input上传1var img = new Image();
        var url = window.URL.createObjectURL(file);//得到bolb对象路径，可当成img.src = url;
        document.getElementById("preview").src=url;

    }
</script>
</body>
</html>
